﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GraphPackage;
using HTMLPackage;

namespace Crawler
{
    public class Crawler
    {
        private BasicGraphImpl _sitemap = new BasicGraphImpl();
        private HtmlDocRegEx _startpage = null;
        private string _url = null;

        public Crawler(string url)
        {
            this._url = url;
            this._startpage = new HtmlDocRegEx(url);
        }

        public HtmlDocRegEx StartPage
        {
            get { return this._startpage; }
        }

        public BasicGraphImpl Sitemap
        {
            get { return this._sitemap; }
        }

        public string Url
        {
            get { return this._url; }
        }

        public void BuildSitemap()
        {
            IList<Uri> links = this._startpage.GetAllLinks();
        }

        private Vertex GetNextUnvisited(IList<HtmlDocRegEx> links)
        {
            return new Vertex("blah");
        }

        public IEnumerator<Vertex> TraverseMap()
        {
            return this._sitemap.Vertices();
        }
    }
}
